package com.haredot.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.haredot.service.CollectService;
import com.haredot.vo.CollectVO;
import com.haredot.vo.R;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/collect")
public class CollectController {

    @Resource
    private CollectService collectService ;

    @GetMapping("/list")
    public R<Page<CollectVO>> collectList(@RequestParam(value = "page", required = false, defaultValue = "1") Long current,
                                          @RequestParam(value = "rows", required = false, defaultValue = "10") Long rows) {
        // 创建一个分页对象
        Page<CollectVO> page = new Page<>(current, rows);
        // 查询具体的业务
        return collectService.queryCollectsByPage(page);
    }
}
